package cn.kgm.lamda;

import cn.kgm.entity.User;
import org.springframework.util.StringUtils;

import java.util.Optional;

/**
 * Create by kappi on
 * 2021/11/12/012 9:29
 */
public class OptinalTes {

    public static void main(String[] args) {
        User u = new User();
        String mf = Optional.of(u)
                .map(User::getName)
                .filter(StringUtils::isEmpty).orElse("mf");
        System.out.println(mf);
        Optional.of(u).map(User::getAge).ifPresent(System.out::println);
    }
}
